package com.maixun.lib_choosefile.adapter

import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter

/**
 * @author：Lmoumou
 * @date：2020/9/30
 */
class PagerAdapter : FragmentStateAdapter {
    constructor(
        fragment: Fragment,
        dataList: MutableList<Fragment>
    ) : super(fragment) {
        this.fragmentList = dataList
    }

    constructor(activity: AppCompatActivity, dataList: MutableList<Fragment>) : super(activity) {
        this.fragmentList = dataList
    }

    private var fragmentList: MutableList<Fragment>
    override fun getItemCount(): Int =fragmentList.size

    override fun createFragment(position: Int): Fragment =fragmentList[position]
}